fix: repair failing tests and type errors across monorepo - #106
Open
stooit wants to merge 1 commit into
Open
Conversation
…nd icon-only button a11y - bunfig.toml: register happy-dom via preload so @testing-library render() has document - tsconfig.json: add bun-types so 'bun:test' resolves under tsc --noEmit - apps/web/src/lib/api.ts: import/re-export renamed hook useDebounce (was useThrottle) - packages/utils/src/format/date.ts: en-GB + 2-digit month so single-digit day is not zero-padded (day-first, 4-digit year) - packages/ui Button: provide aria-label for icon-only buttons (WCAG 2.2 SC 4.1.2) bun test: 13 pass / 0 fail; tsc --noEmit: clean. No test files, package.json, or lockfiles modified.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes all failing tests and type errors in the monorepo. Final state:
bun test→ 13 pass / 0 fail,tsc --noEmit→ clean (exit 0).Five root causes across four packages, six source/config files changed. No test files,
package.json, or lockfiles were modified, and no dependencies were added.Fixes
document is not definedin all React component testsbunfig.tomlenvironment = "happy-dom"key was a no-op for Bun's test runner. Replaced with apreloadthat registers the happy-dom DOM environment so@testing-library/react'srender()has adocument. Moved 4→8 passing on its own.Cannot find module 'bun:test'(TS2307 ×4)tsconfig.json"types": ["bun-types"]sobun:testresolves undertsc --noEmit.bun-typeswas already installed.@e2e/utilshas no exported memberuseThrottle(TS2305)apps/web/src/lib/api.tsuseDebounceinpackages/utils; updated the import and re-export to match the actual exported symbol.formatDatezero-pads single-digit day (01/03/2024vs expected1/03/2024)packages/utils/src/format/date.tsen-GB+month: "2-digit"so the day is not zero-padded while keeping day-first ordering and a 4-digit year. Verified across single/double-digit day and month.packages/ui/.../Button.tsxaria-label(from an explicit prop, or string children as a fallback), plus a dev-only warning when none is available. WCAG 2.2 AA SC 4.1.2 remediation.packages/ui/.../DataTable.tsxreceived a behaviour-neutral tidy-up (functional state updater + removal of a misleadingBUG:comment); the "stale closure" premise turned out to be a false positive — those tests passed once the DOM environment was registered.Assumptions & decisions
aria-labelfallback (incl. the generic"button"last resort). Review flagged that a generic fallback can mask an unlabelled control from automated audits, but dropping it would failButton.test.tsx(which asserts a non-null label even with no children). Per the "do not modify tests / fix only what tests require" constraint, the fallback stays. Backlog item, not a blocker.formatDateTimeonen-AU. It has no failing test; changing it for locale consistency withformatDatewould exceed "fix only what tests require." Review confirmed no correctness regression.docs/scratch output created during review was intentionally not committed.Verification
bun test→ 13 pass / 0 fail (theiconOnly requires aria-labelline in output is the intended dev warning from the test that deliberately omits the label, not a failure).npx tsc --noEmit→ exit 0.git diff --name-onlyconfirmed no test files,package.json, or lockfiles touched.